package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.stat.StatQueryDateVo;
import com.cskaoyan.bean.stat.StatQueryGoodsDateVo;
import com.cskaoyan.bean.stat.StatQueryOrderDateVo;
import com.cskaoyan.service.StatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin/stat")
public class StatController {

    @Autowired
    StatService statService;

    @GetMapping("user")
    public BaseRespVo user(){

        StatQueryDateVo statQueryDateVo = statService.queryAll();

        BaseRespVo<Object> baseRespVo = new BaseRespVo<>();
        baseRespVo.setErrmsg("成功");
        baseRespVo.setErrno(0);
        baseRespVo.setData(statQueryDateVo);
        return baseRespVo;
    }

    @GetMapping("order")
    public BaseRespVo order(){

        StatQueryOrderDateVo statQueryOrderDateVo = statService.queryOrder();

        BaseRespVo<Object> baseRespVo = new BaseRespVo<>();
        baseRespVo.setErrno(0);
        baseRespVo.setErrmsg("成功");
        baseRespVo.setData(statQueryOrderDateVo);
        return baseRespVo;

    }

    @GetMapping("goods")
    public BaseRespVo goods(){

        StatQueryGoodsDateVo statQueryGoodsDateVo = statService.queryGoods();

        BaseRespVo<Object> baseRespVo = new BaseRespVo<>();
        baseRespVo.setErrno(0);
        baseRespVo.setErrmsg("成功");
        baseRespVo.setData(statQueryGoodsDateVo);
        return baseRespVo;
    }
}
